
#include "GameRole.h"
#include "Memento.h"
#include <iostream>

using namespace npMemento;


//other constructors

//public methods
shared_ptr<Memento> GameRole::saveAsMemo() const throw()
{
    return make_shared<Memento>(this->vitality, this->attack_, this->defense);
}

void GameRole::loadFromMemo(shared_ptr<Memento>&& memo) throw()
{
    this->vitality = memo->getVitality();
    this->attack_ = memo->getAttack();
    this->defense = memo->getDefense();
}

void GameRole::show() const throw()
{
    cout << "vitality: " << this->vitality << endl
         << "attack:   " << this->attack_  << endl
         << "defense:  " << this->defense  << endl;
}

void GameRole::attack() throw()
{
    this->vitality -= 10;
    this->attack_ -= 10;
    this->defense -= 10;
}

//protected methods

//private methods

//static part

//others
